// encodeBuffer.js
const args = process.argv.slice(2);

if (args.length < 2) {
    console.log('请提供用户名和密码参数');
    process.exit(1);
}

const username = args[0];
const password = args[1];

console.log(`用户名:${username} 密码:${password}`);

// 创建格式为 "username:password" 的字符串
const credentials = `${username}:${password}`;

// 使用 Buffer 进行 base64 编码
const encoded = Buffer.from(credentials).toString('base64');

console.log(`base64加密: ${encoded}`);